# -*- coding: utf-8 -*-
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from config import Config

db = SQLAlchemy()


def create_app(name=None):
    from .api import rpc
    app = Flask(__name__, instance_relative_config=True)
    # 注册配置文件
    app.config.from_object(Config)
    db.init_app(app)
    # 注册 Blueprint
    if name:
        rpc.init_app(app)
    return app
